<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Lunr multi-language demo</title>
    <script src="../test/lunr/lunr-2.0.0-alpha.5.js"></script>
    <script src="../lunr.stemmer.support.js"></script>
    <script src="../lunr.ru.js"></script>
    <script src="../lunr.multi.js"></script>
</head>
<body>
    <p>Open developer tools and observe the results in the Console tab. View source for code.</p>
    <script>
        /* init lunr */
        var idxEn = lunr(function () {
            this.field('body')
            this.add({"body": "Этот текст написан на русском.", "id": 1})
            this.add({"body": "This text is written in the English language.", "id": 2})
        });

        var idxRu = lunr(function () {
            this.use(lunr.ru);
            this.field('body')
            this.add({"body": "Этот текст написан на русском.", "id": 1})
            this.add({"body": "This text is written in the English language.", "id": 2})
        });

        var idxMulti = lunr(function () {
            this.use(lunr.multiLanguage('en', 'ru'));
            this.field('body')
            this.add({"body": "Этот текст написан на русском.", "id": 1})
            this.add({"body": "This text is written in the English language.", "id": 2})
        });

        console.log('Search for `Русских` (English pipeline): ', idxEn.search('Русских'));
        console.log('Search for `languages` (English pipeline): ', idxEn.search('languages'));

        console.log('Search for `Русских` (Russian pipeline): ', idxRu.search('Русских'));
        console.log('Search for `languages` (Russian pipeline): ', idxRu.search('languages'));

        console.log('Search for `Русских` (Ru + En pipeline): ', idxMulti.search('Русских'));
        console.log('Search for `languages` (Ru + En pipeline): ', idxMulti.search('languages'));

    </script>
</body>
</html>
